import 'package:flutter/material.dart';
import '../services/screenAdapter.dart';
import '../modules/home/controllers/home_controller.dart';
import 'package:get/get.dart';

class Groupsetting extends StatelessWidget {
  Groupsetting({super.key});

  final HomeController controller = Get.find();

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.fromLTRB(
        ScreenAdapter.width(200),
        ScreenAdapter.height(100),
        ScreenAdapter.width(200),
        0,
      ),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                '分组名称：',
                style: TextStyle(
                  fontSize: ScreenAdapter.fontSize(16),
                  fontWeight: FontWeight.w600,
                ),
              ),
              Expanded(
                child: TextFormField(
                  controller: controller.editGroupNameController,
                  decoration: InputDecoration(
                    hintText: "请输入分组名称",

                    border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(8),
                      borderSide: BorderSide(color: Colors.grey[300]!),
                    ),
                  ),
                ),
              ),
            ],
          ),

          SizedBox(height: ScreenAdapter.height(24)),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                '分组简介：',
                style: TextStyle(
                  fontSize: ScreenAdapter.fontSize(16),
                  fontWeight: FontWeight.w600,
                ),
              ),
              Expanded(
                child: TextFormField(
                  controller: controller.editGroupDescController,
                  maxLines: 3,
                  maxLength: 200,
                  decoration: InputDecoration(
                    hintText: "请输入分组简介",
                    border: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(8),
                      borderSide: BorderSide(color: Colors.grey[300]!),
                    ),
                  ),
                ),
              ),
            ],
          ),
          SizedBox(height: ScreenAdapter.height(24)),

          // 操作按钮
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              ElevatedButton(
                onPressed: () {
                  controller.submitDelGroupForm();
                },
                style: ElevatedButton.styleFrom(
                  padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
                ),
                child: Text('删除'),
              ),
              SizedBox(width: ScreenAdapter.width(16)),
              ElevatedButton(
                onPressed: () {
                  controller.submitEditGroupForm();
                },
                style: ElevatedButton.styleFrom(
                  padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
                ),
                child: Text('更新'),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
